package wwy.Controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import wwy.Dao.BookDao;
import wwy.Dto.HomeDto;
import wwy.Entity.Book;
import wwy.Service.HomeService;

import java.util.List;

@RestController
@Tag(name = "home", description = "主页" )
@RequestMapping("/home")
public class HomeController extends LogicController<HomeService, BookDao, Book,Long> {
    public HomeController( HomeService service) {super(service);}

    @GetMapping
    @Operation(summary = "获取主页的书籍信息")
    public List<HomeDto> getHomeBookInfo() {
        return service.getHomeBookInfo();
    }
    @PutMapping("/updateLocalBookAddress")
    @Operation(summary = "更新本地书籍地址")
    public void updateProgress(String bookName, String localBookAddress) {
        service.setLocalBookAddress(bookName, localBookAddress);
    }

}

